<?php 

$sql = "
select 
    A.TABLE_NAME        AS TABLE_NAME,
    A.INDEX_NAME        AS INDEX_NAME,
    B.COLUMN_NAME       AS COLUMN_NAME,
    B.COLUMN_POSITION   AS COLUMN_POSITION,
    B.DESCEND           AS DESCEND,
    case 
		when A.UNIQUENESS = 'UNIQUE' then 'U'
		else ''
	end					AS UQ,
	NVL(
        (SELECT 'PK' as pk 
        FROM USER_CONSTRAINTS 
		where 
            TABLE_NAME = A.TABLE_NAME
            and CONSTRAINT_TYPE = 'P' 
			AND CONSTRAINT_NAME = A.INDEX_NAME)	
	, '')				AS PK,
	A.INDEX_TYPE		AS INDEX_TYPE,
	''					AS ISNULL,
	''					AS \"COMMENT\"
from 
    user_indexes A
    , user_ind_columns B
where
    A.table_name = B.table_name
    and A.index_name = B.index_name
    and A.table_name = '{$param['object']}'
    
";

return $sql;


?>